﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BLL;

public partial class MyLy_MylyOnline : System.Web.UI.Page
{
    BLL.TransCardPoints2UserAccount trans = new TransCardPoints2UserAccount();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["LoginUser"] == null)
        {
            Response.Redirect(WebUtility.getWebRootPath() + "/Login/Login.aspx");
        }
    }
    protected void ImgBtn_Trans_Click(object sender, ImageClickEventArgs e)
    {
        string mobile = WebUtility.replaceStr(this.mobilePhone.Text.Trim());
        string cardNo = WebUtility.replaceStr(this.realName.Text.Trim());
        string password = WebUtility.replaceStr(this.password.Text.Trim());
        //-1:卡号不合法;-2:咨询卡密码不合法;-3:用户帐户不合法;-4:咨询卡卡号和密码不匹配或卡已过期;1：充值成功
        int flag = trans.transCardPoints(cardNo,password,mobile);
        //转账成功
        if (flag == 1)
        {
            this.Lbl_ErrorInfo.Text = "充值成功";
        }
        //转账失败 
        else 
        {
            this.Lbl_ErrorInfo.Text = "充值失败,错误原因可能为：咨询卡信息不匹配或咨询卡为赠卡、该卡超过有效期、用户账号不存在";
         
        }
    }
}
